<template>
  <div>
    <el-dialog title="新增用户" :visible.sync="thistype" @close="fun(tname)">
      <el-form label-width="80px" :model="form" ref="form">
        <el-form-item label="姓名">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="协议" >
          <el-input v-model="form.xieyi"></el-input>
        </el-form-item>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button @click="thistype = false">取 消</el-button>
        <el-button type="primary" @click="thistype = false">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: ['type', 'fun', 'tname'],
  data () {
    return {
      thistype: this.type, // 模态框状态，
      form: {
        name: '', // 学员姓名
        xieyi: ''// 协议
      }
    }
  },
  methods: {
    // 判断用户信息是否填写完整
    upuser () {
      var type = false
      for (var i in this.form) {
        if (this.form[i] === '') {
          type = true
        }
      }
      if (type) {
        // 请求接口并传递数据
      } else {
        // console.log('111');
        this.$message.error('请补全信息')
      }
    }
  },
  watch: {
    // 监听模态框的状态
    type () {
      this.thistype = this.type
    }
  }
}
</script>

<style>
</style>
